// 模拟连接用户登录的接口
export const login = ({ username, password }) => {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      if (username === 'test' && password === 'abcdefg') {
        resolve({
          username,
          avatarUrl: 'http://xxx.com.1.png',
          token: 'abaaffjegoeokgweeafehyjyjet'
        })
      } else {
        const err = new Error('用户名或密码错误')
        reject(err)
      }
    }, 1000)
  })
}
